package montaltoUtils
import scala.util.Random
/**
 * Created by IntelliJ IDEA.
 * User: Andrew Montalto
 * Date: Apr 24, 2010
 * Time: 11:19:20 PM
 * To change this template use File | Settings | File Templates.
 */

//singleton design patern for random number generation
class RandomSingleton private () {
  val random:Random =new Random()
  def nextPosInt(mod:Int):Int={
    return scala.Math.abs( random.nextInt() % mod )
  }

}

object RandomSingleton {
  lazy val INSTANCE = new RandomSingleton();
  def apply() = INSTANCE
}

//iterator interfact
trait MyIterator[T] {
  def current():T
  def hasNext():Boolean
  def next():Unit
  def first():Unit
}



